feat(cli)!: hosted OpenProse service commands in both ports; remove service environment selection - #10
Open
rawwerks wants to merge 1 commit into
Open
feat(cli)!: hosted OpenProse service commands in both ports; remove service environment selection#10rawwerks wants to merge 1 commit into
rawwerks wants to merge 1 commit into
Conversation
`prose cli` becomes a noninteractive client of the hosted OpenProse service, implemented independently in the Rust and Bun products and held equivalent by one shared manifest and conformance corpus. New commands (both products): - cli service status|triage|capabilities|operations|guide - cli model list (with each model's status: available, premium or accepted-but-not-recommended), cli example list|show, cli repo list - cli run quote|submit|watch|input|cancel|list|show|download|share - cli program list|show|save|visibility|delete|revisions|draft - cli result list|show|publish|unpublish - cli job ... (schedule and webhook jobs, contracts, deliveries) - cli wallet balance|events|usage|redeem|topup - cli org ... (no organization deletion) The existing cli auth and cli package commands share the same account connection and error model. Behavior: - Every command emits versioned, canonical JSON (openprose.service-operation/1) or JSONL (openprose.service-event/1, ending in exactly one terminal line) and never prompts. Human output shows prices in dollars and ends with copyable next commands. - Commands that spend money, publish outward, delete, or cannot be undone stop with CONFIRMATION_REQUIRED (exit 2) until repeated with --yes; --preview prints the planned request without sending it. - A submitted run is journaled locally before it is sent. Ctrl-C, a lost stream or the --wait deadline detach without cancelling (HOSTED_RUN_DETACHED, exit 21) and return the exact resume command; an unconfirmable submission exits RUN_SUBMISSION_AMBIGUOUS instead of resubmitting. Only `cli run cancel --yes` cancels. - Misspelled or misplaced commands and options exit 2 with a complete, parseable corrected command in details.suggestedArgv; nothing is guessed into execution. - Keys come from OPENPROSE_API_KEY or the OS credential store written by `cli auth login`. The Rust product on Linux uses secret-tool and reads and writes the same item as the Bun product. - Results carry prices only; result schemas refuse cost-named properties. - New error taxonomy codes, including CONFIRMATION_REQUIRED, SERVICE_RESOURCE_NOT_FOUND, SERVICE_WRITE_CONFLICT, GITHUB_LINK_REQUIRED, SERVICE_PREMIUM_MODEL_LOCKED, HOSTED_RUN_DETACHED (21), HOSTED_RUN_FAILED (22), RUN_SUBMISSION_AMBIGUOUS (22) and HOSTED_RUN_CANCELLED (24). How the two implementations stay equivalent: - cli/shared/service/operations.v1.json is the single operation manifest. Both products embed it and derive parsing, help, confirmation rules and transport limits from it; `cli service operations --json` prints it. - Help text and the agent guide are rendered from the manifest and printed byte for byte by both products. - The shared corpus under cli/conformance/cases/service/ runs unmodified against a test-seam build of each product through a fixture transport (no network). Coverage, help and corpus gates check that every operation has success and failure cases and that manifest, taxonomy and schemas agree. Service endpoint and builds: - Public builds talk only to the production OpenProse service. - A contributor-only developer build (cargo feature `dev-endpoint`, Bun `bun run build:dev`) additionally honours OPENPROSE_API_URL. The override is compiled out of default and release builds, stores its key under a separate origin-scoped credential entry, and labels its output as a custom endpoint. - A new public-surface gate (cli/ci/check_public_surface.py), run locally and in CI, checks tracked files, both products' release help and the release Rust binary for developer-only or internal service detail. BREAKING CHANGE: service environment selection is removed. The global --service-environment option and `cli environment show|use|reset` now fail with INVOCATION_INVALID (exit 2), OPENPROSE_STAGING_API_KEY is no longer read, a saved service_environment key in the user cli.toml is ignored, and shared/schemas/service-environment.schema.json is deleted; every command reaches the production service. BREAKING CHANGE: `cli auth *`, `cli org list` and `cli package *` now print the openprose.service-operation/1 envelope instead of their own service-account, organization-list and package-operation documents (dotted operation names such as auth.status, no environment member, sorted keys, credentialSource "store"). BREAKING CHANGE: a malformed key is SERVICE_AUTH_REQUIRED with credentialProblem "malformed" (was SERVICE_PROTOCOL_INVALID); a registry 404 is SERVICE_RESOURCE_NOT_FOUND and not retryable (was SERVICE_UNAVAILABLE); an invalid package reference, slug, version, --sha256 or --cursor is INVOCATION_INVALID (exit 2) in the service-operation envelope (was CONFIG_INVALID). See cli/CHANGELOG.md. Prepared by Raymond Weitekamp's Claude Code (AI coding agent), acting on Raymond's behalf and published from his account with his approval. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prose clibecomes a noninteractive client of the hosted OpenProse service. Both products, Rust and Bun, gain the same commands:cli service status|triage|capabilities|operations|guide,cli model list,cli example list|show,cli repo listcli run quote|submit|watch|input|cancelcli run list|show|download|sharecli program list|show|save|visibility|delete|revisions|draftcli result list|show|publish|unpublishcli job ...(schedule and webhook jobs, contracts, deliveries)cli wallet balance|events|usage|redeem|topupcli org ...(no organization deletion)The existing
cli authandcli packagecommands share the same account connection, error model and output envelope.Behavior, in brief:
openprose.service-operation/1) or JSONL (openprose.service-event/1, ending in exactly one terminal line). Commands never prompt. Both products print the same bytes.CONFIRMATION_REQUIREDand show the planned request until repeated with--yes.--previewshows the plan and sends nothing.run submitjournals the run locally before sending it. Ctrl-C, a lost stream or the--waitdeadline detach without cancelling (exit 21) and return the exact resume command. An unconfirmable submission exitsRUN_SUBMISSION_AMBIGUOUSinstead of resubmitting. Onlyrun cancel --yescancels.details.suggestedArgv. Nothing is guessed into execution.OPENPROSE_API_KEYor the OS credential store (cli auth login). On Linux the Rust product now usessecret-tooland shares one store item with the Bun product.cli model listshows each model's status: available, premium (unlocks with any wallet top-up) or accepted but not recommended; choosing a locked premium model fails withSERVICE_PREMIUM_MODEL_LOCKEDand a top-up preview command.User docs:
docs/hosted-service-client.md(overview),docs/service/<feature>.md(per feature), andcli/shared/service/guide.v1.md, which is printed byprose cli service guide. The normative contract is the "Hosted service operations" section ofcli/SPEC.md.Breaking changes
This PR removes the service environment selection that was previously public. The full notes are under
### Breakingincli/CHANGELOG.md.cli environment show|use|resetare gone. They fail withINVOCATION_INVALID(exit 2).--service-environmentoption is gone. It fails withINVOCATION_INVALID(exit 2), and the message says the option was removed.OPENPROSE_STAGING_API_KEYis no longer read. A savedservice_environmentkey in the usercli.tomlis ignored, so every command now reaches production. Runprose cli auth statusto see which credential is in use.cli auth *,cli org listandcli package *now print theopenprose.service-operation/1envelope instead of their ownservice-account,organization-listandpackage-operationdocuments. Operation names are dotted (auth.status), there is noenvironmentmember, keys are sorted, and a stored key reportscredentialSource: "store".shared/schemas/service-environment.schema.jsonis deleted.SERVICE_AUTH_REQUIREDwithcredentialProblem: "malformed". It was previouslySERVICE_PROTOCOL_INVALID.--sha256or--cursorisINVOCATION_INVALID(exit 2) in the service-operation envelope. It was previouslyCONFIG_INVALID.cli packagecommands, a registry 404 is nowSERVICE_RESOURCE_NOT_FOUND(exit 10, not retryable). It was previously the retryableSERVICE_UNAVAILABLE.No npm package or release binary changes until the next published alpha.
Reading guide
The diff is about 1,420 files. Most of them are shared corpus cases (about 1,090); the rest are code, schemas, docs and tooling. Review in this order.
1. The contract (start here)
cli/shared/service/operations.v1.jsoncli/shared/service/operations.schema.json,cli/shared/service/README.mdcli/SPEC.md, section "Hosted service operations"cli/shared/errors/taxonomy.v1.jsoncli/shared/schemas/service-*.schema.json,cli/shared/schemas/service/*.schema.jsoncli/shared/service/responses/*.schema.json2. The shared corpus and its runner
cli/conformance/runner/service_operations.pyruns each case against a product binary through the fixture transport.service-fixture.schema.jsondefines the case format, andcanonical_json.pyholds the byte-exact comparison helpers.cli/conformance/runner/service_coverage.pyrequires every operation to have at least one success case and one failure case. It also requires requests to match the vendored interaction export.cli/conformance/cases/service/README.mdexplains the layout: one directory per feature, one case per file.3. Each product's service module
The two products mirror each other file for file, so review them side by side:
cli/rust/crates/prose-runner-core/src/service/)cli/bun/src/core/service/)mod.rs(dispatch, credential resolution, error classification)index.ts,manifest.tshttp.rs,sse.rs,fs.rs,journal.rshttp.ts,sse.ts,fs.ts,journal.tsrender.rs(canonical JSON, human output, redaction)render.tsruns.rs,run_records.rs,programs.rs,program_ref.rs,results.rs,jobs.rs,wallet.rs,organizations.rs,discovery.rs,triage.rs,not_found.rsmod.rs, Bun incredentials.ts)dev_endpoint.rsdev-endpoint.ts,endpoint.tsThe wiring is in
cli/rust/crates/prose-cli/src/main.rs,prose-runner-core/src/{invocation,runner,service_account,config}.rs,cli/bun/src/{cli,main}.tsandcli/bun/src/core/{args,config,service-account}.ts.4. Credential handling
cli/rust/crates/prose-runner-core/src/credential_store.rsis new. It is the Linuxsecret-toolbackend: a fixed argv with no shell, the key passed on stdin, trusted-directory program lookup, a scrubbed environment, and time and output bounds. macOS continues to use/usr/bin/security.cli/bun/src/core/service/credentials.tshandles key-shape classification and thecredentialSource/credentialProblemdetails.docs/service/credentials.mddocuments the shared store item and the threat model.cli/rust/crates/prose-cli/tests/credential_store.rsandcli/bun/test/credential-store-interop.test.ts.5. The public-surface gate
cli/ci/check_public_surface.pychecks the tracked files. With--build-release, it also checks both products' release--helpoutput, the guide and manifest invocations, and the strings in the release Rust binary.cli/ci/public_surface_denylist.pyholds the generic patterns (hostnames, key shapes, environment options, debug detail).cli/ci/test_check_public_surface.pytests the gate. It is wired intorun_local.pyand.github/workflows/cli-distribution-check.yml.6. Tooling
cli/ci/render_service_help.pyrendershelp.v1.jsonand the pinned help and guide cases from the manifest. Its--checkoption validates everyprose cli ...line in the guide and examples.cli/ci/sync_service_interactions.pyre-vendors the service's public interaction export.cli/ci/run_local.pyandtest_run_local.pyadd the new gate inventory.check_architecture.pyandcheck_workflows.pyget their admissions.Generated or fixture data (skim)
cli/conformance/cases/service/**holds about 1,090 black-box cases, each with argv, scripted service exchanges and expected bytes. Spot-check a few per feature. The runner and coverage gates enforce the rest.cli/shared/service/help.v1.jsonis generated byrender_service_help.py --write. Never edit it by hand.cli/shared/service/service-interactions.{v1,source}.jsonis the vendored projection and its digests, written by the sync script.framework/service-guide-*andframework/help-*cases are generated from the guide and manifest.cli/shared/fixtures/andcli/conformance/cases/{core,dx,operations,fixtures}follow the environment removal and help changes.Unrelated cleanups in this diff
docs/expedition-baseline.md,provenance/import.jsonandexperiments/**.docs/validation/).cli/protocol/decisions/registry-cli.mdandweave-host.md.docs/staging-account.mdis removed along with the environment selection.Build and test locally
Prerequisites: a Rust toolchain, Bun and Python 3, as described in
cli/CONTRIBUTING.md.The corpus gates use a fixture transport and never touch the network. Nothing in the gates spends money or needs a key.
To try the release build against the service yourself:
prose cli auth login # or: export OPENPROSE_API_KEY=... prose cli service triage --json prose cli run quote --jsoncli run submitspends from your wallet and requires--yes.Note for contributors: developer endpoint build
Public builds cannot be pointed anywhere but production. Contributors who work against another service origin use a separate developer build:
Only a developer build reads
OPENPROSE_API_URL, and the value must be anhttpsorigin with no path, query or credentials.cli auth loginstores that build's key under an entry scoped to the origin, so it never overwrites the production key. Human output is labeledOpenProse (custom endpoint <origin>). CI keeps this build compiling and tested with therust-*-dev-endpointgates. Seecli/CONTRIBUTING.md, "Developer endpoint build".Known follow-ups
OPENPROSE_API_KEYthere. The Bun product usesBun.secretson all platforms."x-probed": falsedescribe shapes that have not yet been checked against live responses. They require only the fields the client reads, so extra fields are tolerated.🤖 Generated with Claude Code